package com.abc.core;

import com.abc.core.consts.DataType;
import com.abc.core.def.Dna;
import com.abc.core.def.Vd;
import com.abc.core.instance.bo.Cell;
import com.abc.core.instance.bo.Inst;

/**
 * DefaultMetaFactory
 */
public class DefaultMetaFactory {

    public static Dna getPartyDna() {
        Dna partyDna = new Dna("partyCode", "partyCode", "party结构dna");

        partyDna.addVd(new Vd("partyCode", "party代码", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("partyName", "party名称", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("birthday", "出生日期", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("gender", "性别", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("certType", "证件类型", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("certId", "证件号码", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("address", "地址", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("mobile", "移动电话", DataType.DATA_TYPE_STRING));
        partyDna.addVd(new Vd("contact", "联系人", DataType.DATA_TYPE_STRING));

        return partyDna;
    }

    public static Inst getPartyInst() {
        Inst partyInst = new Inst("partyCode", "party结构dnaInst");
        Cell partyCell = partyInst.getSingleCell();
        partyCell.setVaByName("partyName", "张三");
        partyCell.setVaByName("certType", "01");
        partyCell.setVaByName("certId", "123456789012345678");
        partyCell.setVaByName("concat", "李四");

        Inst accountInst = new Inst("accontCode", "account Dna Inst");
        Cell accountCell = accountInst.getSingleCell();
        accountCell.setVaByName("accountName", "张三");
        accountCell.setVaByName("accountNo", "10000101011");
        accountCell.setVaByName("bankName", "中国银行");

        Inst anotherAccountInst = new Inst("accountCode", "account Dan Inst 2");
        Cell anotherCell = anotherAccountInst.getSingleCell();
        anotherCell.setVaByName("accountName", "张三");
        anotherCell.setVaByName("accountNo", "20000111");
        anotherCell.setVaByName("bankName", "建设银行");

        accountInst.addCell(anotherCell);
        partyCell.addChildInst(accountInst.getDnaName(), accountInst.getDnaCode(), accountInst);


        return partyInst;
    }

}
